<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>登录</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />
		<script type="text/javascript" src="lib/jquery.js"></script>
		<script type="text/javascript" src="lib/browserdetect.js"></script>
		<style type="text/css">
			body{border:0px;margin:0px;color:white;}
			#show{display:none;}
			#show,#hide{color:white;cursor:pointer;}
		</style>
	<script type="text/javascript">
		$(function() {

			$.ajax({
				type: "get",
				url: "login.asp",
				dataType: "json",
				success: function(data){
					if(data.login){
						$("#loginbar").hide();
						$("#user").html(data.usr);
						//if (data.flag==15)
						//{
						//	$("#mg").show();
						//}else{
						//	$("#mg").hide();
						//}
						$("#showbar").show();
					}else{
						$("#usr").select();
					}
				}
			});



			$("#showbar").hide();
			$("#psw").keypress(function(e){
				if (e.which==13) $("#login").click();
			});
			$("#psw").focus(function(){$(this).select();});
			$("#login").click(function(){
				$.post("login.asp",{usr:$("#usr").val(),psw:$("#psw").val()}, function(data){
					if(data.login){
						//window.location.reload();
						$("#loginbar").hide();
						$("#user").html(data.usr);
						//if (data.post==15)
						//{
						//	$("#mg").show();
						//}else{
						//	$("#mg").hide();
						//}
						$("#showbar").show();
						window.parent.mainFrame.location.reload();
					}else{
						alert("登陆错误！");
						$("#usr").select();
					}
				},"json");
			});
			$("#logout").click(function(){
				$.get("login.asp?logout=logout", function(){
						$("#psw").val("");
						$("#loginbar").show();
						$("#showbar").hide();
						$("#usr").select();
						window.parent.mainFrame.location.reload();
				//window.location.reload();
				});
			});
			$("#cpsw").click(function(){
				window.open("change_pass.asp","change_pass","height=180px, width=260px, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
			});
			$("#mg").click(function(){
				//window.parent.leftFrame.location.href="manage_left.html";
				window.parent.mainFrame.location.href="manage_user.asp";
				//window.open("manage_index.html","_parent");
			});
//			$("#login").click();
			$("#bi").text("您正在使用的浏览器是"+BrowserDetect.browser+" "+BrowserDetect.version+"，操作系统是"+BrowserDetect.OS);
			
			$("#hide").click(function(){
				$(this).hide();
				$("#show").show();
				window.top.document.getElementById("mainFrameset").cols="0,*";
			});
			$("#show").click(function(){
				$(this).hide();
				$("#hide").show();
				window.top.document.getElementById("mainFrameset").cols="144,*";
			});
			
		});
	</script>
</head>
<body>
	<table width="100%" bgcolor="#003399">
		<tr>
		<td><span id="bi"></span>，IP:<%response.write(Request.ServerVariables("REMOTE_ADDR"))%></td>
		<td>
			<span id="hide">隐藏左导航</span>
			<span id="show">显示左导航</span>
		</td>
			<td align="right">
				<div>
					<span id="loginbar">
						用户名：<input id="usr" name="usr" type="text" size="10" />
						密码：<input id="psw" name="psw" type="password" size="10" />
						<input id="login" name="login" type="button" value="登陆" />
					</span>
					<span id="showbar">
						你好，<span id="user"></span>&nbsp;&nbsp;
						<input id="cpsw" name="cpsw" type="button" value="修改密码" />
						<input id="mg" name="mg" type="button" value="管理" />
						<input id="logout" name="logout" type="button" value="注销" />
					</span>
				</div>
			</td>
		</tr>
	</table>
</body>
</html>
